<?php defined('SYSPATH') OR die('No direct access allowed.');

class Gym_Model extends ORM 
{
	protected $has_one = array('city');
	protected $has_many = array('products');
	
	public function get_gym($id)
	{
		return $this->find($id);
	}

	public function get_all_gym_in_sold()
	{
		return $this->where('state', 'sold')->find_all();
	}

	public function get_city_zone($id)
	{
		return $this->get_gym($id)->city->zone;
	}

	public function get_city_name($id)
	{
		return $this->get_gym($id)->city->name;
	}

} // End Gym Model

